using System.IO;
using SQLServices.RunnableItems;

namespace SQLRunnerLib.RunnableItems
{
    public class ItemPath : IItemPath
    {

        private readonly string _rootPath;
        private readonly string _fullPath;

        public ItemPath(string rootPath, string fullPath)
        {
            
            _fullPath = fullPath;
            if (_fullPath.StartsWith(rootPath))
            {
                _rootPath = rootPath;
            }
            else
            {
                _rootPath = Path.GetPathRoot(_fullPath);
            }
        }
        #region IItemPath Members

        public string  RootPath
        {
	        get { return _rootPath; }
        }

        public string FullPath
        {
            get { return _fullPath; }
        }

        public string RelativePath
        {
            get { return _fullPath.Replace(_fullPath, _rootPath); }
        }

        #endregion
    
    }
}
